<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/taglib.jsp"%>
<jsp:include page="/WEB-INF/common/head.jsp" flush="true" />
 <div class="easyui-panel addPage" data-options="fit:true,border:false,novalidate:true">
    <form class="easyui-form" id="ff" method="post" data-options="novalidate:true">
        <table class="table1">
            <tr>
           		<th><span>数据源服务器:</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" style="width:40%" type="text" name="data_host" value="${data_host}" ></input></div>
               		
           		</td>
           	</tr>
            <tr>	
           		<th><span>数据源用户名:</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" style="width:40%" type="text" name="data_user" value="${data_user}" ></input></div>
           		</td>
            </tr>
            <tr>
           		<th><span>数据源密码:</span></th>
               	<td>
               		<div class="wrap_input"><input type ="password" class="easyui-textbox"  style="width:40%" type="text" name="data_password" value="${data_password}" ></input></div>
           		</td>
           	</tr>

           	 <tr>
           		<th><span>同步周期:</span></th>
               	<td>
               	<div class="wrap_input">
               			<select id="circle" class="easyui-combobox" name="dept" style="width:200px;">
    							<option value = "1">每天同步</option>
   								<option value = "2">每周同步</option>
  							    <option value = "3">手动同步</option>
						</select>
               		</div>
           		</td>
        </table>
    </form>
</div>
	<script type="text/javascript">
		
	top.window.subPage.save = save;
	jQuery(function($) {
		 var circle = "${circle}";
		 if(circle == 1 ){
			 $('#circle').combobox('setValue',"1").combobox('setText',"每天同步");	
		 }else if(circle == 2 ){
			 $('#circle').combobox('setValue',"2").combobox('setText',"每周同步");
		 }else if(circle == 3 ){
			 $('#circle').combobox('setValue',"3").combobox('setText',"手动同步");
		 }else{
			 $('#circle').combobox('setValue',"1").combobox('setText',"每天同步");
		 }
	 });
	
	top.window.subPage.save = save;
	function save() {
		if($("#ff").form('enableValidation').form('validate')) {
			$.post("${context_path}/sys/config/siteConfigSave", getParam(), function(data) {
				top.window.closeWindow();
				top.window.subPage.loadCurrDatagrid();
				if (data.code == 0) {
				
					showMsg("配置成功");
				}  else{
				
					showMsg(data.msg);
				} 
			},"json");
		}
	}
	
	function getParam() {
		var param = {
	       	    "data_host": $(":input[name='data_host']").val(), 
	       	    "data_user": $(":input[name='data_user']").val(), 
	       	    "data_password": $(":input[name='data_password']").val(),
	       	    "circle":  $('#circle').combobox('getValue')	
		}
		for(key in param) {
			if(!param[key]) {
				delete param[key];
			}
		}
		return param;
	}
	

	
		</script>
  <jsp:include page="/WEB-INF/common/dialogWindow.jsp" flush="true" />
   <jsp:include page="/WEB-INF/common/foot.jsp" flush="true" />
